// 项目内的模型策划接口
import request from '@/utils/request'

export function queryProjPlan(params) {
  return request({
    url: 'api/inspectPlan/queryProjPlan',
    method: 'get',
    params
  })
}

export function add(data) {
  return request({
    url: '/api/inspectPlan/createProjPlan',
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: '/api/inspectPlan/updateProjPlan',
    method: 'put',
    data
  })
}

// 批量编辑
export function batchEdit(data) {
  return request({
    url: '/api/inspectPlan/batchUpdateProjPlan',
    method: 'post',
    data
  })
}

export function del(id) {
  return request({
    url: `api/inspectPlan/${id}`,
    method: 'delete'
  })
}

// 获取发起人列表
export function queryPromoterItemWithProj(data) {
  return request({
    url: '/api/inspectPlan/queryPromoterItemWithProj',
    method: 'post',
    data
  })
}

// 获取发起人列表Step2
export function queryPlanToDoUserWithProj(params) {
  return request({
    url: '/api/inspectPlan/queryPlanToDoUserWithProj',
    method: 'get',
    params
  })
}

// 获取模型审查员候选项
export function queryCheckerItemWithProj(data) {
  return request({
    url: '/api/inspectPlan/queryCheckerItemWithProj',
    method: 'post',
    data
  })
}

// 获取引用页面数据

export function queryReferenceInspectPlan(params) {
  return request({
    url: '/api/inspectPlan/queryReferenceInspectPlan',
    method: 'get',
    params
  })
}
// 获取引用详情数据
export function queryProjInspectPlanInfoByReference(params) {
  return request({
    url: '/api/inspectPlan/queryProjInspectPlanInfoByReference',
    method: 'get',
    params
  })
}
// 扭转审查状态 -未开始（流转）
export function turnoverStatus(params) {
  const { planId, inspectStatus } = params
  return request({
    url: `/api/inspectPlan/turnover/${planId}/${inspectStatus}`,
    method: 'post'
  })
}

// 检查编辑时是否需要填写理由
export function checkIsReason(params) {
  return request({
    url: '/api/inspectPlan/checkIsReason',
    method: 'get',
    params
  })
}

/* 列表相关*/
// 列表页子项+发起人+模型审查员 下拉框数据
export function queryCriteriaForProjPlan(params) {
  return request({
    url: '/api/inspectPlan/queryCriteriaForProjPlan',
    method: 'get',
    params
  })
}

// 工场-模型策划编辑后，添加理由
export function updateStandardConfigRecord(data) { // 多一个Reason字段
  return request({
    url: '/api/standardConfigRecord',
    method: 'post',
    data
  })
}

// 发布企微
export function deployProjPlan(data) {
  return request({
    url: '/api/inspectPlan/deployProjPlan',
    method: 'post',
    data
  })
}
// 查询评审结果
export function queryResultScoreForPlanV2(params) {
  return request({
    url: 'api/inspectPlanStatisticData/queryInspectPlanDetail',
    method: 'get',
    params
  })
}
export default { add, edit, del }
